﻿////////////////////////////////////////////////////////////////////////
//Autor: Gabriel Tame Borao  - gabrieltame@yahoo.es 
//Fecha: 2010/09/15 01:26
//Solucion: GTameReport.sln
//Proyecto: GTameReport
//Fichero: GroupingType.cs
//
//	Copyright (C) 2010  Gabriel Tame Borao (GTB)
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
namespace GTameReport
{
    using Rdl;
    using System;
    using System.Collections;

    public class GroupingType
    {
        private GTameReport.CustomPropertiesType _CustomProperties;
        private string _DataCollectionName;
        private string _DataElementName;
        private GroupingTypeDataElementOutput _DataElementOutput;
        private GTameReport.FiltersType _Filters;
        private GTameReport.GroupExpressionsType _GroupExpressions;
        private string _Label;
        private bool? _PageBreakAtEnd = null;
        private bool? _PageBreakAtStart = null;
        private string _Parent;
        private string nameField;

        public Rdl.GroupingType Write()
        {
            Rdl.GroupingType type = new Rdl.GroupingType();
            ArrayList list = new ArrayList();
            ArrayList list2 = new ArrayList();
            type.Name = this.nameField;
            if (this._CustomProperties != null)
            {
                list.Add(this._CustomProperties.Write());
                list2.Add(ItemsChoiceType17.CustomProperties);
            }
            if (this._DataCollectionName != null)
            {
                list.Add(this._DataCollectionName);
                list2.Add(ItemsChoiceType17.DataCollectionName);
            }
            if (this._DataElementName != null)
            {
                list.Add(this._DataElementName);
                list2.Add(ItemsChoiceType17.DataElementName);
            }
            list.Add(this._DataElementOutput);
            list2.Add(ItemsChoiceType17.DataElementOutput);
            if (this._Filters != null)
            {
                list.Add(this._Filters.Write());
                list2.Add(ItemsChoiceType17.Filters);
            }
            if (this._GroupExpressions != null)
            {
                list.Add(this._GroupExpressions.Write());
                list2.Add(ItemsChoiceType17.GroupExpressions);
            }
            if (this._Label != null)
            {
                list.Add(this._Label);
                list2.Add(ItemsChoiceType17.Label);
            }
            if (this._PageBreakAtEnd.HasValue)
            {
                list.Add(this._PageBreakAtEnd);
                list2.Add(ItemsChoiceType17.PageBreakAtEnd);
            }
            if (this._PageBreakAtStart.HasValue)
            {
                list.Add(this._PageBreakAtStart);
                list2.Add(ItemsChoiceType17.PageBreakAtStart);
            }
            if (this._Parent != null)
            {
                list.Add(this._Parent);
                list2.Add(ItemsChoiceType17.Parent);
            }
            type.Items = list.ToArray();
            type.ItemsElementName = (ItemsChoiceType17[]) list2.ToArray(typeof(ItemsChoiceType17));
            list2 = null;
            list = null;
            return type;
        }

        public GTameReport.CustomPropertiesType CustomProperties
        {
            get
            {
                if (this._CustomProperties == null)
                {
                    this._CustomProperties = new GTameReport.CustomPropertiesType();
                }
                return this._CustomProperties;
            }
            set
            {
                this._CustomProperties = value;
            }
        }

        public string DataCollectionName
        {
            get
            {
                return this._DataCollectionName;
            }
            set
            {
                this._DataCollectionName = value;
            }
        }

        public string DataElementName
        {
            get
            {
                return this._DataElementName;
            }
            set
            {
                this._DataElementName = value;
            }
        }

        public GroupingTypeDataElementOutput DataElementOutput
        {
            get
            {
                return this._DataElementOutput;
            }
            set
            {
                this._DataElementOutput = value;
            }
        }

        public GTameReport.FiltersType Filters
        {
            get
            {
                if (this._Filters == null)
                {
                    this._Filters = new GTameReport.FiltersType();
                }
                return this._Filters;
            }
            set
            {
                this._Filters = value;
            }
        }

        public GTameReport.GroupExpressionsType GroupExpressions
        {
            get
            {
                if (this._GroupExpressions == null)
                {
                    this._GroupExpressions = new GTameReport.GroupExpressionsType();
                }
                return this._GroupExpressions;
            }
            set
            {
                this._GroupExpressions = value;
            }
        }

        public string Label
        {
            get
            {
                return this._Label;
            }
            set
            {
                this._Label = value;
            }
        }

        public string Name
        {
            get
            {
                return this.nameField;
            }
            set
            {
                this.nameField = value;
            }
        }

        public bool? PageBreakAtEnd
        {
            get
            {
                return this._PageBreakAtEnd;
            }
            set
            {
                this._PageBreakAtEnd = value;
            }
        }

        public bool? PageBreakAtStart
        {
            get
            {
                return this._PageBreakAtStart;
            }
            set
            {
                this._PageBreakAtStart = value;
            }
        }

        public string Parent
        {
            get
            {
                return this._Parent;
            }
            set
            {
                this._Parent = value;
            }
        }
    }
}

